<?php   
include_once "commonDao.php"; 
class adminDao extends commonDao {  
    
     public function __construct(){
        parent::__construct();
        $this->table_name = 'admin';  
        $this->fields = "name,pwd";
    }   
      
    /** 
     * 新增
     * @param $user 
     */  
    public function addTest($user) {  
        $user = $this->init_db()->build_key($user, $this->fields);  
        return $this->init_db()->insert($user, $this->table_name);  
    }  
      
    /** 
     * 通过ID获取一条数据 
     * @param unknown_type $id 
     */  
    public function getOne($id) {  
        return $this->init_db()->get_one($id, $this->table_name);  
    } 

    /**
     * 获得一条数据
     * @param  array $arr 
     * @return [type]      
     */
    function getAdminByField($arr) { 
        return $this->init_db()->get_one_by_field($arr,$this->table_name);
    } 

    /**
     * 跟新数据
     * @param  [type] $arr   
     * @param  [type] $field 
     * @return [type]        
     */
    function adminUpdate($arr, $field){
        return $this->init_db()->update_by_field($arr, $field , $this->table_name);
    }
} 